<template>
	<view class="img-list" >
		<image src="../../static/project/top.png" style="height: 38px;width: 750upx;margin: 0;" mode="aspectFit"></image>
		<view class="img-list" v-for="(item, index) in thumbnailList " :key="index">
			<image :src="item.url" @click="toDetail(item.realEstateProject)" mode="aspectFit"
				style="height:260px;width:390px;margin:0px;position:relative;top:-10px;"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				thumbnailList: [],
				companyId: 8
			}
		},
		onShow() {
			//请求项目缩略图列表
			this.thumbnailList = []
			uni.request({
				url: this.baseUrl + `api/thumbnail/getByCompanyId/${this.companyId}`, //仅为示例，并非真实接口地址。
				success: (res) => {
					console.log("res.data", res.data);
					for (var i = 0; i < res.data.length; i++) {
						var obj = {}
						obj.url = this.baseUrl + "file/图片/" + res.data[i].thumbnailUrl;
						obj.realEstateProject = res.data[i].realestateId;
						this.thumbnailList.push(obj);
					}
					this.text = 'request success';
				}
			});
		},
		methods: {
			toDetail(id) {
				console.log(id);
				uni.navigateTo({
					url: "/pages/realEstateProduct/realEstateProduct" + "?id=" + id,
					success: (res) => {
						console.log('跳转成功.')
					}
				})
			},
		}
	}
</script>

<style>
	.img-list {
		display: flex;
		flex-direction: column;
	}
</style>
